<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
    <!-- 新 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="css/main.css">
    <link rel="stylesheet" href="css/style.css">
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
    <script src="js/jquery.min.js"></script>
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="js/bootstrap.min.js"></script>
    <script type="text/javascript" src="js/jquery.toast.min.js"></script>
    <script type="text/javascript" src="js/common.js"></script>
    <link rel="stylesheet" href="css/jquery.toast.min.css">
    <script src="js/common.js"></script>
    <title>店鋪活動</title>
</head>
<script type="text/javascript">

    function del(parentId) {
        var scrollTop = parent.document.body.scrollTop;
        document.getElementById("modal-dialog9").style.top=scrollTop+220+'px';
        $('#del-active1').show();
        $('#delvalue').val(parentId);
    }

    function delCancel() {

        $('#del-active1').hide();
        $('#delvalue').val('');

        $('#revoke-active').hide();
        $('#cancelValue').val('');
    }

    function delActive1() {

        var parentId = $('#delvalue').val();
        $.ajax({
            async : false,
            url : "../takeOutActivity/delActivity.shtml",
            data : 'parentId=' + parentId,
            success : function(msg) {
                if (msg) {
                    $('#del-active1').hide();
                    window.location = "../takeOutActivity/list.shtml";
                }
            }
        });

    }

    function cancel(parentId) {
        var scrollTop = parent.document.body.scrollTop;
        document.getElementById("modal-dialog8").style.top=scrollTop+220+'px';
        $('#revoke-active').show();
        $('#cancelValue').val(parentId);
    }

    function cancelActive() {

        var parentId = $('#cancelValue').val();
        $.ajax({
            async : false,
            url : "../takeOutActivity/cancelActivity.shtml",
            data : 'parentId=' + parentId,
            success : function(msg) {
                if (msg) {
                    $('#revoke-active').hide();
                    window.location = "../takeOutActivity/list.shtml";
                }
            }
        });

    }

    function checkFullCut() {
        var value = $("input[id='fullCutStatus2']").length;
        var value2 = $("input[id='fullCutStatus3']").length;
        if (value >= 1 || value2 >= 1) {
            com.toast('当前已存在满减活动，无法进行创建');
            return;
        }
        window.location = "../takeOutActivity/addActivity.shtml?typeId=FULLCUT"
    }

    function checkHandSel() {
        var value = $("input[id='handSelStatus2']").length;
        var value2 = $("input[id='handSelStatus3']").length;
        if (value >= 1 || value2 >= 1) {
            com.toast('当前已存在满赠活动，无法进行创建');
            return;
        }
        window.location = "../takeOutActivity/addActivity.shtml?typeId=HANDSEL"
    }

    $(function() {
        $("#reduced-activity").click(function() {
            window.location = '../takeOutActivity/addActivity.shtml';
        });
    })
</script>
<body>
<div class="marketing-main" style="position: relative;">
    <div class="main-title">店鋪活動</div>
    <div class="marketing-content">
        <div class="reduced-activity">
            <div class="reduced-activity-title">
                <label style="font-weight: 700; color: #6c6767;">滿減優惠</label> <a href="javascript:checkFullCut();"><button class="btn btn-default reduced-activity-btn" style="background: #00a189; color: white; border: none; outline: none;">創建活動</button></a>
            </div>

            <div class="reduced-activity-content">
                <table class="reduced-table">
                    <tr>
                        <td>狀態</td>
                        <td>活動內容</td>
                        <td>操作</td>
                    </tr>

                    <tr id="tr201610251748380721336418">
                        <td id="stat201610251748380721336418"><s>已失效</s>   <input type="hidden" id="fullCutStatus1" name="stat"
                                                                                  value="status"></td>
                        <td>满50减10</td>
                        <td><a href="/service/takeOutActivity/detail.shtml?typeId=FULLCUT&parentId=201610251748380721336418" class="see-activity">查看詳情</a>
                            <a href="javascript:del('201610251748380721336418')" class="del-activity">刪除活動</a>
                        </td>
                    </tr>

                    <tr id="tr201611081631520760142665">
                        <td id="stat201611081631520760142665"><s>已失效</s>   <input type="hidden" id="fullCutStatus1" name="stat"
                                                                                  value="status"></td>
                        <td>满100减10,满200减20,满300减50</td>
                        <td><a href="/service/takeOutActivity/detail.shtml?typeId=FULLCUT&parentId=201611081631520760142665" class="see-activity">查看詳情</a>
                            <a href="javascript:del('201611081631520760142665')" class="del-activity">刪除活動</a>
                        </td>
                    </tr>

                    <tr id="tr201611090945350829703816">
                        <td id="stat201611090945350829703816"><s>已失效</s>   <input type="hidden" id="fullCutStatus1" name="stat"
                                                                                  value="status"></td>
                        <td>满10减5</td>
                        <td><a href="/service/takeOutActivity/detail.shtml?typeId=FULLCUT&parentId=201611090945350829703816" class="see-activity">查看詳情</a>
                            <a href="javascript:del('201611090945350829703816')" class="del-activity">刪除活動</a>
                        </td>
                    </tr>

                    <tr id="tr201611091037110354424049">
                        <td id="stat201611091037110354424049">  <span style="color: #00a189;">已生效</span> <input type="hidden" id="fullCutStatus3" name="stat"
                                                                                                                value="status"></td>
                        <td>满1000减100</td>
                        <td><a href="/service/takeOutActivity/detail.shtml?typeId=FULLCUT&parentId=201611091037110354424049" class="see-activity">查看詳情</a>
                            <a href="javascript:cancel('201611091037110354424049');" class="del-activity">撤銷活動</a>
                        </td>
                    </tr>

                </table>
            </div>



        </div>
        <div class="full-activity">
            <div class="reduced-activity-title full-activity-title">
                <label style="font-weight: 700; color: #6c6767;">满赠活动</label> <a href="javascript:checkHandSel();"><button class="btn btn-default reduced-activity-btn" style="background: #00a189; color: white; border: none; outline: none;">創建活動</button></a>
            </div>
            <div class="reduced-activity-content full-activity-content" id="tr">
                <table class="reduced-table full-table">
                    <tr>
                        <td>狀態</td>
                        <td>活動內容</td>
                        <td>操作</td>
                    </tr>

                    <tr>
                        <td id="stat201611111633090345756028">

                            未生效

                            <input type="hidden" id="handSelStatus2" name="stat" value="status"></td>
                        <td>满100赠可樂1罐,满200赠可樂3罐</td>
                        <td><a href="/service/takeOutActivity/detail.shtml?typeId=HANDSEL&parentId=201611111633090345756028" class="see-activity">查看詳情</a>
                            <a href="javascript:del('201611111633090345756028')" class="del-activity">刪除活動</a>
                        </td>
                    </tr>

                </table>
            </div>


        </div>
    </div>
</div>

<!-- 删除失效 -->
<div class="myModal" id="del-active1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" id="modal-dialog9" role="document" style="width: 500px; height: 370px;">
        <form action="" name="ff">
            <input type="hidden" id="delvalue" value="">
            <div class="modal-content">
                <div class="modal-body del-modal class-list-modal" style="clear: both; padding: 20px 20px;">
                    <h4 style="color: #6c6666;">信息提示</h4>
                    <a style="float: right; text-decoration: none; margin-top: -35px; text-align: center; font-size: 20px; color: #6c6666;" onclick="delCancel();">×</a>
                    <div style="clear: both; margin-top: 20px; border: none; color: #6c6666; width: 300px; margin: 0 auto">确定删除活动？</div>
                </div>
                <div class="modal-footer class-list-btn" style="border-top: none">
                    <button type="button" class="btn btn-default" data-dismiss="modal" style="border-radius: 5px; border: none; background: #ececec; outline: none; color: #6b6766" onclick="delCancel();">取消</button>
                    <button type="button" class="btn btn-default" style="outline: none; background: #00a189; color: white; border: none; border-radius: 5px;" onclick="delActive1();">確定</button>
                </div>
            </div>
        </form>
    </div>
</div>

<!-- 撤销 -->
<div class="myModal" id="revoke-active" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" id="modal-dialog8" role="document" style="width: 500px; height: 370px;">
        <form action="" name="ff">
            <input type="hidden" id="cancelValue" value="">
            <div class="modal-content">
                <div class="modal-body del-modal class-list-modal" style="clear: both; padding: 20px 20px;">
                    <h4 style="color: #6c6666;">信息提示</h4>
                    <a style="float: right; text-decoration: none; margin-top: -35px; text-align: center; font-size: 20px; color: #6c6666;" onclick="hide()">×</a>
                    <div style="clear: both; margin-top: 20px; border: none; color: #6c6666; width: 300px; margin: 0 auto">活動撤銷后，顧客下單將不再享受此優惠， 有可能會轉移到其他有優惠的商家喲~您確 定要撤銷此活動嗎？</div>
                </div>
                <div class="modal-footer class-list-btn" style="border-top: none">
                    <button type="button" class="btn btn-default" data-dismiss="modal" style="border-radius: 5px; border: none; background: #ececec; outline: none; color: #6b6766" onclick="cancelActive();">確定撤銷</button>
                    <button type="button" class="btn btn-default" style="outline: none; background: #00a189; color: white; border: none; border-radius: 5px;" onclick="delCancel();">保留活動</button>
                </div>
            </div>
        </form>
    </div>
</div>
</body>
</html>